﻿// Licensed under GNU GPL V2.
// http://sps2010listmanager.codeplex.com/
// (c) 2010 by Daniel Bedarf

using System;
namespace CodePlex.DBedarf.Sharepoint.ListManager.Update
{

    /// <summary>
    /// Informations about the available Update
    /// </summary>
    struct UpdateInfo
    {
        public void Clear()
        {
            Titel = "";
            Message = "";
            URL = "";
            Version = new Version();
            HTMLHistory = "";
        }

        /// <summary>
        /// The UpdateTitle
        /// </summary>
        public string Titel;

        /// <summary>
        /// the Update Messageblock
        /// </summary>
        public string Message;

        /// <summary>
        /// A URL for more Information
        /// </summary>
        public string URL;

        /// <summary>
        /// the new VersionID (not the ApplicationVersion)
        /// </summary>
        public System.Version  Version;

        /// <summary>
        /// a HTML Text with History Informations
        /// </summary>
        public string HTMLHistory;
    }

    interface IUpdater
    {
        /// <summary>
        /// True if DoUpdate is Allowed
        /// </summary>
        bool CanHandleUpdates { get; }

        /// <summary>
        /// Performs a update (close app and download + install new version)
        /// </summary>
        void DoUpdate();

        /// <summary>
        /// Check for a available update
        /// </summary>
        /// <param name="CurrentVersion"></param>
        /// <returns></returns>
        bool IsUpdateAvailable(Version CurrentVersion, out UpdateInfo Info);
    }
}
